load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

# gazelle:go_grpc_compilers //pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_grpc_compiler,  @com_github_grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway:go_gen_grpc_gateway

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
    name = "loqrecoverypb_proto",
    srcs = [
        "recovery.proto",
    ],
    strip_import_prefix = "/pkg",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/roachpb:roachpb_proto",
        "@com_github_gogo_protobuf//gogoproto:gogo_proto",
        "@com_google_protobuf//:timestamp_proto",
    ],
)

go_proto_library(
    name = "loqrecoverypb_go_proto",
    compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/loqrecovery/loqrecoverypb",
    proto = ":loqrecoverypb_proto",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/roachpb",
        "@com_github_gogo_protobuf//gogoproto",
    ],
)

go_library(
    name = "loqrecoverypb",
    srcs = ["recovery.go"],
    embed = [":loqrecoverypb_go_proto"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/loqrecovery/loqrecoverypb",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/kv/kvpb",
        "//pkg/roachpb",
        "//pkg/util/keysutil",
        "//pkg/util/log/eventpb",
        "//pkg/util/log/logpb",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_gogo_protobuf//proto",
    ],
)

go_test(
    name = "loqrecoverypb_test",
    srcs = ["recovery_test.go"],
    embed = [":loqrecoverypb"],
    deps = [
        "//pkg/roachpb",
        "//pkg/util/uuid",
        "@com_github_stretchr_testify//require",
    ],
)
